class PunchDataClient {
    public String getToken() throws IOException {
        URL url = new URL("https://connect-drcn.dbankcloud.cn/agc/apigw/oauth2/v1/token");
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestMethod("POST");
        connection.setRequestProperty("Content-Type", "application/json");
        connection.setDoOutput(true);

        String requestBody = "{\"useJwt\":\"1\",\"grant_type\":\"client_credentials\","
                + "\"client_id\":\"1654531991325938240\","
                + "\"client_secret\":\"1B2371A951B71755B739CFE76A1673F0E8661A3637DED8EE8C3DAB0A840CFB84\"}";

        try (OutputStream os = connection.getOutputStream()) {
            byte[] input = requestBody.getBytes("utf-8");
            os.write(input, 0, input.length);
        }

        int responseCode = connection.getResponseCode();
        if (responseCode == HttpURLConnection.HTTP_OK) {
            try (BufferedReader br = new BufferedReader(
                    new InputStreamReader(connection.getInputStream(), "utf-8"))) {
                StringBuilder response = new StringBuilder();
                String responseLine;
                while ((responseLine = br.readLine()) != null) {
                    response.append(responseLine.trim());
                }
                // 这里返回原始JSON响应，你可以根据需要解析特定字段如access_token
                return response.toString();
            }
        } else {
            throw new IOException("Request failed with HTTP code: " + responseCode);
        }
    }

    public static void main(String[] args) {
        String token = this.getToken();
        System.out.println("token: " + token);
        return 0;
    }
}